<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/11
 * Time: 16:33
 */
var_dump($_FILES);
var_dump($_POST);
$img  = base64_decode($_POST['data'][0]);
$a = file_put_contents('./test.jpg', $img);//返回的是字节数

/*foreach ($_FILES["file"]["tmp_name"] as $key=>$val){
    if (file_exists($path.'/'. $_FILES["file"]["name"][$key]))
    {
        echo $_FILES["file"]["name"] . " already exists. ";
    }
    else
    {
        move_uploaded_file($_FILES["file"]["tmp_name"][$key],
            $path.'/'. $_FILES["file"]["name"][$key]);
        echo "Stored in: " . $path. $_FILES["file"]["name"][$key];
    }
}*/
/*if (file_exists("/weui/upload/" . $_FILES["file"]["name"]))
{
    echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
    move_uploaded_file($_FILES["file"]["tmp_name"],
        "/weui/upload/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "/weui/upload/" . $_FILES["file"]["name"];
}*/
